Parameters
- n
- the name of the new
XElement
Return Value
XElement
XElement
XElement
holding the data of this link.XElement
XElement
This constructs a new XElement
and adds an XAttribute
for each simple property that has a value different from its default value. For each property that is a collection, it adds an XElement
with nested item elements. This does not add an element if the collection is empty.
Because the NodeKey type might be a type for which we have an implementation to convert to and from strings for XML, this calls the ConvertNodeKeyToString method, which you can override.
This is implemented as: public virtual XElement MakeXElement(XName n) { XElement e = new XElement(n); e.Add(XHelper.Attribute<NodeKey>("From", this.From, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute<NodeKey>("To", this.To, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute<PortKey>("FromPort", this.FromPort, default(PortKey), ConvertPortKeyToString)); e.Add(XHelper.Attribute<PortKey>("ToPort", this.ToPort, default(PortKey), ConvertPortKeyToString)); e.Add(XHelper.Attribute<NodeKey>("LabelNode", this.LabelNode, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute("Category", this.Category, "")); e.Add(XHelper.Attribute("Text", this.Text, "")); e.Add(XHelper.Attribute("Points", this.Points, null)); return e; }
If you add properties to this link data class, and if you are using the GraphLinksModel<NodeType,NodeKey,PortKey,LinkType>.Save<NodeDataType,LinkDataType> and GraphLinksModel<NodeType,NodeKey,PortKey,LinkType>.Load<NodeDataType,LinkDataType> methods, you should override this method to add new attributes and/or elements as needed, and you should override LoadFromXElement.